package net.zbus.loadbalance;

import net.zbus.BusClient;
import net.zbus.ClientPool;
import net.zbus.ClientPoolConfig;
import net.zbus.ZMsg;


public class ClientExample {
 
	public static void main(String[] args) throws InterruptedException { 
		ClientPoolConfig config = new ClientPoolConfig();
		config.setHost("127.0.0.1"); 
		config.setPort(15555);

		ClientPool pool = new ClientPool(config);
		
		BusClient client = pool.borrowClient();

		///////////////////////////////////////////////
		ZMsg msg = new ZMsg();  
		msg.pushBack("{\"method\":\"1\",\"params\":[1]}");
		
		ZMsg res = client.request("MyRpc", msg);  
		
		res.dump();  
		
		///////////////////////////////////////////////
		pool.returnClient(client);
		pool.destroy();
	}

}
